// pages/selected/selected.js
const app = getApp()
var server = require('../../utils/server');
var that
Page({

  /**
   * 页面的初始数据
   */
  data: {
    picpath:'',
    list:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    that = this
    console.log(e)
    if(e.id!='undefined'){
      var id = JSON.parse(e.id);
    }else{
      var id = []
    }
   
    wx.setNavigationBarTitle({
      title: e.title
    })
    that.setData({
      picpath:e.picpath,
      id:id
    })
    that.list(id)
  },

  list:function(idd){
    server.requestForm(false, 'get', 'card', {
      filter: {
        _id:{$in:idd} 
      }
    }, function(e) {
      console.log(e)
      that.setData({
        list:e.data
      })

    })
  },
  carddetails: function(e) {
    console.log(e)
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '../carddetails/carddetails?id=' + id,
    })
  },
})